package com.jcroke.PC32.transformer;

import java.util.Hashtable;
import java.util.LinkedHashMap;

import com.jcroke.PC32.basetransform.DefaultTransformer;
import com.jcroke.PC32.datum.Datum;
import com.jcroke.PC32.datum.dString;

/**
 * 
 * @author jcroke
 *
 */
public class Concatenator extends DefaultTransformer {

	// Input tags
	private final String DELIM = "input1";
	private final String FIRST_HALF = "input2";
	private final String SECOND_HALF = "input3";
	private final String OUTPUT = "concat_out";

	public void execute() {

		LinkedHashMap<String, Datum> inputs = getInput();

		String delim = inputs.get(DELIM).toString();
		String first_half = inputs.get(FIRST_HALF).toString();
		String second_half = inputs.get(SECOND_HALF).toString();

		Datum output = new dString(first_half + delim + second_half);

		Hashtable<String, Datum> outputs = new Hashtable<String, Datum>();

		outputs.put(OUTPUT, output); 
		emit(outputs);
	}

}
